package com.liuyi.netty.im.commons.codes.data.event.message.playload;

import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * 语音类型消息载体
 *
 * @author Mr.Fmy
 * @since 2021-12-08
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class PlayloadVoice extends Playload implements Serializable {

    private static final long serialVersionUID = -8907573598780735507L;

    /**
     * 语音地址
     */
    private String voiceUrl;

    /**
     * 语音长度
     */
    private long voiceLength;

    @Override
    public String getText() {
        return "[语音]";
    }


    public static final class PlayloadVoiceBuilder {
        private String voiceUrl;
        private long voiceLength;

        private PlayloadVoiceBuilder() {
        }

        public static PlayloadVoiceBuilder aPlayloadVoice() {
            return new PlayloadVoiceBuilder();
        }

        public PlayloadVoiceBuilder voiceUrl(String voiceUrl) {
            this.voiceUrl = voiceUrl;
            return this;
        }

        public PlayloadVoiceBuilder voiceLength(long voiceLength) {
            this.voiceLength = voiceLength;
            return this;
        }

        public PlayloadVoice build() {
            PlayloadVoice playloadVoice = new PlayloadVoice();
            playloadVoice.setVoiceUrl(voiceUrl);
            playloadVoice.setVoiceLength(voiceLength);
            return playloadVoice;
        }
    }
}
